//动态规划

function  getLongest(arr){

  let maxLength = 0
  let dp = [[]]

  for (let i=0;i<arr.length;i++){


    dp[i] = [arr[i]]

    for (let j = i+1; j < arr.length; j++) {

      if(arr[j]>dp[i][dp[i].length - 1]){
        dp[i].push(arr[j])
        console.log(dp)
      }
    }
    if(maxLength <dp.length) {
      maxLength = dp.length
    }

  }

  console.log(maxLength)
return dp
}



const arr = [13,3,2,5,7,8,9,12,10]

console.log(getLongest(arr))





